package com.example.exception;

import com.example.utils.ResultEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

//异常

@Data
public class Exception extends RuntimeException{

    @ApiModelProperty(value = "状态码")
    private Integer code;
        /**
         * 接受状态码和消息
         * @param code
         * @param message
         */

    public Exception(Integer code, String message) {

        super(message);
        this.code=code;
    }

        /**
         * 接收枚举类型
         * @param resultCodeEnum
         */
    public Exception(ResultEnum resultCodeEnum) {
        super(resultCodeEnum.getMsg());
        this.code = resultCodeEnum.getCode();
    }

}
